package net.wofly.sale.activity.service;

import net.wofly.common.persistence.PageWrapper;
import net.wofly.framework.util.ReturnBean;
import net.wofly.sale.activity.domain.Activity;
import net.wofly.sale.activity.domain.ActivityGift;

import java.util.List;

public interface IActivityService {
    
    /**
     * 增加或修改
     *
     * @param entity
     * @return
     */
    public Activity save(Activity entity);
    
    /**
     * 删除
     *
     * @param entity
     * @return
     */
    public void delete(Activity entity);
    
    /**
     * 根据主键ID删除
     *
     * @param key
     * @return
     */
    public void delete(String key);
    
    /**
     * 根据主键查询
     *
     * @param key
     * @return
     */
    public Activity findOne(String key);
    
    public List<Activity> save(List<Activity> entityList);
    
    List<Activity> findByCommodityChannelIDAndStatusAndStartTimeBeforeAndEndTimeAfter(
            String commodityChannelID, Integer status, long nowTime1, long nowTime2);
    
    List<Activity> findByOrderTypeAndCommodityChannelIDAndStatusAndStartTimeBeforeAndEndTimeAfter(
            Integer orderType, String commodityChannelID, Integer status, long nowTime1, long nowTime2);
    
    List<Activity> findByActivityType(Integer activityType);
    
    List<Activity> findByActivityTypeAndStatusAndStartTimeBeforeAndEndTimeAfter(
            Integer activityType, Integer status, long nowTime1, long nowTime2);
    
    /**
     * 新增活动
     * <ul>
     * <li>新增一个活动，具体活动内容在ActivityGift中体现</li>
     * <li></li>
     * </ul>
     *
     * @param activity
     */
    public ReturnBean<Activity> addActivity(Activity activity);
    
    /**
     * @param activityID
     * @param activityGift
     */
    public ReturnBean<List<ActivityGift>> addActivityGift(String activityID, ActivityGift activityGift);
    
    /**
     * @param activityID
     */
    public ReturnBean<String> delActivity(String activityID);
    
    List<Activity> findByActivityIDIn(List<String> activityIDs);
    
    /**
     * 获取所有活动
     * <ul>
     * <li></li>
     * </ul>
     *
     * @param status
     * @param pageSize
     * @param pageNum
     */
    public ReturnBean<PageWrapper<Activity>> getAllActivity(
            String activityName, Long startTime, Integer status, Integer pageNum, Integer pageSize);
    
    /**
     * 获取指定商品的活动
     * <ul>
     * <li>只取在开始与结束时间范围内，且是有效的活动</li>
     * <li>取得的活动包括ActivityGift内容</li>
     * </ul>
     *
     * @param commodityChannelID
     */
    public ReturnBean<List<Activity>> getCommodityActivity(String commodityChannelID);
    
    /**
     * 修改活动
     * <ul>
     * <li>只有当活动未生效时，可以修改，一旦生效则不可以修改</li>
     * <li></li>
     * </ul>
     *
     * @param activity
     */
    public ReturnBean<Activity> modifyActivity(Activity activity);
    
    /**
     * 批量添加赠品
     *
     * @param activityID
     * @param activityGifts
     */
    public ReturnBean<List<ActivityGift>> addActivityGifts(String activityID, List<ActivityGift> activityGifts);
    
    /**
     * 获取活动赠品
     *
     * @param activityID
     */
    public ReturnBean<List<ActivityGift>> getActivityGift(String activityID);
    
    /**
     * 发布活动
     *
     * @param activityID
     * @return
     */
    public ReturnBean<Activity> publishActivity(String activityID);
    
    /**
     * 下线活动
     *
     * @param activityID
     * @return
     */
    public ReturnBean<Activity> offlineActivity(String activityID);
    
    /**
     * 活动详情
     *
     * @param activityID
     * @return
     */
    public ReturnBean<Activity> getActivityByID(String activityID);
    
    /**
     * 根据订单类型及活动类型获取活动列表
     *
     * @param orderType
     * @param activityType
     * @return
     */
    public ReturnBean<List<Activity>> getActivityByOrderTypeAndActivityType(Integer orderType, Integer activityType) ;
    
}
